<?php
/**
 * HTML2PDF Librairy - example
 *
 * HTML => PDF convertor
 * distributed under the LGPL License
 *
 * @author      Laurent MINGUET <webmaster@html2pdf.fr>
 *
 * isset($_GET['vuehtml']) is not mandatory
 * it allow to display the result in the HTML format
 */
    // get the HTML
    ob_start();
    $num = '单号：'.date('Ymd');
    $nom = 'DUPONT Alphonse';
    $date = '01/01/2012';
?>
<style type="text/css">
<!--
    div.zone { border: none; border-radius: 6mm; background: #FFFFFF; border-collapse: collapse; padding:3mm; font-size: 2.7mm;}
    h3 { padding: 0; margin: 0; color: #DD0000; font-size: 5mm;}
    h2 { padding: 0; margin: 0; color: #222222; font-size: 5mm; position: relative; }
-->
</style>
<page format="100x200" orientation="L" backcolor="#AAAACC" style="font: arial;">
    <div style="rotate: 90; position: absolute; width: 100mm; height: 4mm; left: 195mm; top: 0; font-style: italic; font-weight: normal; text-align: center; font-size: 2.5mm;">
        重庆广播电视大学重庆工商职业学院质量工程项目经费报销记录单
    </div>
    <table style="width: 99%;border: none;" cellspacing="4mm" cellpadding="0">
        <tr>
            <td colspan="2" style="width: 100%">
                <div class="zone" style="height: 34mm;position: relative;font-size: 4mm;">
                    <div style="position: absolute; right: 3mm; top: 3mm; text-align: right; font-size: 4mm; ">
                        SN：<b>20131126151254</b><br>
                    </div>
                    <div style="position: absolute; right: 3mm; bottom: 4mm; text-align: right; font-size: 4mm;line-height:5mm; ">
                        <b>未报销经费 ：</b><b>2000.00</b>元<br>
                        <b>项目编号 ：</b><b>gzkc2012-013</b><br>
                        项目类型 ：<b>校级精品资源共享课程</b><br>
                        报销提交时间 ：<b><?php echo date('Y-m-d H:i:s'); ?></b><br>
                    </div>
                    <h3>《网站美工》课程改革项目经费报销单</h3>
                    报销人：<b>黄小冬（教务处）</b><br>
                    <div style="margin-top:3mm;margin-left:20mm;width:40mm">
                        <h1>￥1000.00</h1>
                    </div>
                    <!--<img src="./res/logo.gif" alt="logo" style="margin-top: 3mm; margin-left: 20mm">-->
                </div>
            </td>
        </tr>
        <tr>
            <td style="width: 25%;">
                <div class="zone" style="height: 40mm;vertical-align: middle;text-align: center;">
                    <qrcode value="<?php echo $num."\n".$nom."\n".$date; ?>" ec="Q" style="width: 37mm; border: none;" ></qrcode>
                </div>
            </td>
            <td style="width: 75%;">
                <div class="zone" style="height: 40mm;vertical-align: middle; text-align: justify">
                    <b>报销备注：</b><br>
                    <div style="width:80%;height:25mm;vertical-align:middle;text-align:center;">
                        
                        <?php
                            $str="论文发表版面费、教材印刷费等论文发表版面费、教材印刷费等论文发表版面费、教材印刷费等论文发表版、教材印刷费等";
                            $arr=array();
                            for($i=0;$i<mb_strlen($str);$i=$i+31)
                            {

                               $arr[]=mb_substr($str, $i,30,'UTF-8').'<br>';
                                
                            }
                            $return_str="";
                            foreach ($arr as $s) {
                                $return_str .=$s;

                            }
                            echo $return_str;
                        ?>
                    </div>
                    <br>
                    <i>注：此页仅供记账使用凭证，表明项目经费已被记录。教务处项目管理科保留最终解释权。</i>
                </div>
            </td>
        </tr>
    </table>
</page>
<?php
     $content = ob_get_clean();

    // convert
    require_once(dirname(__FILE__).'/../html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', 0);
        $html2pdf->pdf->SetDisplayMode('fullpage');
        //$html2pdf->pdf->SetFont('droidsansfallback', '', 20);
        $html2pdf->SetDefaultFont('droidsansfallback');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output('ticket.pdf',true);
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }

